<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>66vue中绑定的样式-使用style</title>
  <script src="./vue.js"></script>
  <style>
    .activated {
      color: red;
    }
  </style>
</head>
<body>
  <div id="root">
    <!-- <div @click="handleClick"
         :style="styleObj"> 
      hello world
    </div> -->

    <!-- style写成数组 -->
    <div @click="handleClick"
         :style="[styleObj, {fontSize: '80px'}]"> 
      hello world
    </div>
  </div>
  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        styleObj: {
          color: "black"
        }
      },
      methods: {
        handleClick: function() {
          this.styleObj.color = this.styleObj.color === "black" ? "orange" : "black";
        }
      }
     
    })
  </script>
</body>
</html>